//package com.teaRestaurant.config;
//
//import com.github.pagehelper.PageInterceptor;
//
//import org.apache.ibatis.plugin.Interceptor;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionFactoryBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import javax.sql.DataSource;
//import java.util.Properties;
//
//@Configuration
//public class MyBatisConfig {
//
//    @Bean
//    public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
//        SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
//        sqlSessionFactoryBean.setDataSource(dataSource);
//        // 设置其他 MyBatis 配置，如 typeAliasesPackage 和 mapperLocations
//
//        // 配置 PageHelper 插件
//        PageInterceptor pageInterceptor = new PageInterceptor();
//        Properties properties = new Properties();
//        // 设置 PageHelper 参数，例如：
//        // properties.setProperty("helperDialect", "mysql");
//        pageInterceptor.setProperties(properties);
//        sqlSessionFactoryBean.setPlugins(new Interceptor[]{(Interceptor) pageInterceptor});
//
//        return sqlSessionFactoryBean.getObject();
//    }
//}
